<template>
	<view class="main">
		<u-navbar :is-back="true" title="搜索" :background="background" title-size="32" title-color="#000"  :border-bottom="false" ></u-navbar>
		<view class="input">
			<image src="../../static/images/serch.png" mode=""></image>
			<input type="text" v-model="list" />
		</view>
		<view class="content">
			<view class="user" @click="back()">
				<text>{{info.userBuild[0].buildInfo}}{{info.userBuild[0].buildInfo==''&&info.user.nickName==''?' ':'. 业主：'}} {{info.user.nickName}}</text>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				list: '',
				info: {},
				money:[],
			}
		},
		onLoad() {
			this.getinfo()
			this.getuserinfo()
	
		},
		onShow() {},
		methods: {
			back() {
				// #ifdef APP-NVUE
				const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
				// #endif
				// #ifndef APP-NVUE
				const eventChannel = this.getOpenerEventChannel();
				// #endif
				let vm = {
					id: this.money[0].id,
					name: this.info.user.nickName,
					money: this.money[0].feePayable,
					address: this.info.userBuild[0].buildInfo,
					status: this.money[0].feeStatus,
					month: this.money[0].paymentMonth
				}
				eventChannel.emit('selectType', vm);
				uni.navigateBack({
					delta: 1,
				})
			},
			getinfo() {
				global.$http.request({
					url: '/business/property/getListByLogin',
					method: 'GET',
					header: {
						'Authorization': uni.getStorageSync('token') //自定义请求头信息
					},
					data: {
						pageNum: 1,
						pageSize: 10,
					}
				}).then(res => {
					console.log(res);
					if (res.data.code == 200) {
						console.log('给钱都 ',res.data);
						this.money=res.data.data
					}
				})
			},
			getuserinfo() {
				global.$http.request({
					url: '/getInfo',
					method: 'GET',
					header: {
						'Authorization': uni.getStorageSync('token') //自定义请求头信息
					},
				}).then(res => {
					if (res.data.code == 200) {
						console.log(res.data);
						this.info = res.data
						console.log('参数参数参数参数参数',this.info.userBuild[0].id);
						console.log(this.info.userBuild[0].buildInfo);
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f7f7f7;

		.main {
			width: 750rpx;

			.input {
				width: 690rpx;
				margin: 20rpx auto;
				height: 64rpx;
				background: #FFFFFF;
				border-radius: 32rpx;
				display: flex;
				align-items: center;
				background-color: #fff;

				image {
					width: 28rpx;
					height: 28rpx;
					margin: 38rpx 11rpx 38rpx 31rpx;
				}

				input {
					width: 600rpx;
				}
			}

			.content {
				width: 750rpx;

				.user {
					width: 750rpx;
					background: #FFFFFF;
					padding: 35rpx 40rpx;
					margin-bottom: 1rpx;
				}
			}
		}
	}
</style>
